home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 19
/
CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso
/
CUCD
/
Programming
/
LEDA
/
prog
/
dict
/
hash_dic.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-05
|
360b
|
24 lines
#include <LEDA/hash.h>
int hash_fun(const string& x) { return int(x[0]); }
main()
{
hash<string,int> D(hash_fun);
hash_item it;
string r;
while (cin >> r)
{ it = D.lookup(r);
if (it==nil) D.insert(r,1);
else D.change_inf(it,D.inf(it)+1);
}
forall_items(it,D) cout << D.inf(it) << " " << D.key(it) << "\n";
return 0;
}